<#include "/common/head.ftl">

<@showTitle title="${i18n.getMessage('bookstore.import')} > ${i18n.getMessage('details')}">
	<a href="#" onclick="cc('bookstore/showEditImport.sgt?id=${(importReceipt.id)!}')">${i18n.getMessage('info')}</a>
	- <a href="#" onclick="cc('bookstore/showListOfImport.sgt?id=${(importReceipt.id)!}')">${i18n.getMessage('list')}</a>
</@showTitle>

<div id="error" style="display:none"></div>

<form action="bookstore/addDetail.sgt" validator="bookstore/validateImportDetail.sgt" onsubmit="submitFormValidation(this); return false;" onreset="$('error').hide()">
	<fieldset class="fs">
		<legend>Item</legend>
		<table id="dataTable" cellspacing="5" cellpadding="0" align="center" style="width:100%">
			<input type="hidden" name="id" value="${importReceipt.id}"/>
			<tr>
				<td class="name1">${i18n.getMessage('program')}:</td>
				<td>
					<select id="programId" name="programId" style="width:204px">
						<#list programs as each>
							<option value="${each.id}" <#if (each.id == (programId)!0)>selected</#if>>${each.name}</option>
						</#list>
					</select> <span id="progressMsg"></span>
				</td>
				<td class="name3">${i18n.getMessage('level')}:</td>
				<td>
					<select id="levelId" name="levelId" style="width:204px">
						<option></option>
					</select>
				</td>
			</tr>
			<tr>
				<td class="name1"><@required/>${i18n.getMessage('bookstore.item')}:</td>
				<td>
					<select id="itemId" name="itemId" style="width:204px">
						<option></option>
					</select>
				</td>
				<td class="name3"><@required/>${i18n.getMessage('bookstore.import.quantity')}:</td>
				<td>
					<input type="text" name="quantity"style="width:200px"/>
				</td>
			</tr>
			
			<tr>
				<td class="name1"></td>
				<td>
					<input type="submit" value="${i18n.getMessage('add')}" class="button_style"/> 
				</td>
			</tr>
		</table>
	</fieldset>
</form>
	<fieldset class="fs">
		<legend>Import Details</legend>
<@display.table id="listTable" name="details" pagesize="20">
	<@display.column title="${i18n.getMessage('index')}" style="text-align:center">
		${(listTable_rowNum)!}
	</@display.column>
	<@display.column title="${i18n.getMessage('bookstore.title.name')}">
		${(listTable.item.itemTitle.title)!}
	</@display.column>
	<@display.column title="${i18n.getMessage('bookstore.item.type')}" style="text-align:center">
		${(listTable.item.itemType.name)!}
	</@display.column>
	<@display.column title="${i18n.getMessage('bookstore.import.quantity')}" style="text-align:center">
		${(listTable.quantity)!}
	</@display.column>
	<@display.column title="${i18n.getMessage('level')}" style="text-align:center">
		${(listTable.item.itemTitle.levelsName)!}
	</@display.column>
	<@display.column title="${i18n.getMessage('delete')}" style="text-align:center;width:50px;">
		<img src="images/delete.gif" onclick="if(confirm('${i18n.getMessage('dialog.delete')}')) { cc('bookstore/deleteDetail.sgt?detailId=${listTable.id}'); }" style="cursor:pointer"/>
	</@display.column>
</@display.table>
<p>&nbsp;</p>
</fieldset>
<@ajax.select baseUrl="programlevel.view" source="programId" target="levelId"
	parameters="programId={programId}" executeOnLoad=true defaultOptions="${(levelId)!}"/>
	
<@ajax.select baseUrl="levelitemsearch.view" source="levelId" target="itemId"
	parameters="levelId={levelId}" />